/*
	FileName : JT_C_ADC_RMS.h
	Description :
	Created on 2018.01.08 by WFL.

	Revision History:

*/



#ifndef  __JT_C_ADC_RMS_20180108__
#define  __JT_C_ADC_RMS_20180108__


#include "stdint.h"


//----------------------------------------------------

#define JTC_ADC_RMS_NUMBER_MAX		0xFFFF
#define JTC_ADC_RMS_VAL_MAX			0x0FFF


//JTC application----------------------------------
#define JTC_RMS_CACHE_NUMBER		25
/*
 * No require address align, no require subfield order.
*/
typedef struct{
	uint16_t	RMS_Number;		///
	uint16_t	RMS_Count;		///
	uint32_t	RMS_Sum;		/// sum
	uint64_t	RMS_QuaSum;		/// quadratic sum
	uint16_t	RMS_Result;		/// root mean square
	uint16_t	RMS_Average;
	
	//JTC application-----------
	uint16_t 	RMS_cache[JTC_RMS_CACHE_NUMBER];	/// 
	uint16_t	RMS_biggest;	

}JTC_ADC_RMS, *pJTC_ADC_RMS;
//--------------------------------------------------------------------------
extern JTC_ADC_RMS JTC_rms_12;
extern JTC_ADC_RMS JTC_rms_34;
//-------------------------
uint8_t JTC_ADC_RMS_init(JTC_ADC_RMS *rms,uint16_t number,uint16_t valmax);
uint8_t JTC_ADC_RMS_handle(JTC_ADC_RMS *rms,uint16_t val);
//--------------------------------------------------------------------------
#endif




///EOF


